
 



 
 
 



 
 
 <!DOCTYPE html>
<html>
<head>
 <link rel="icon" type="image/vnd.microsoft.icon" href="http://www.gstatic.com/codesite/ph/images/phosting.ico">
 
 
 <link rel="canonical" href="http://code.google.com/p/processing/wiki/LibraryTemplate" />
 
 <script type="text/javascript">
 
 
 
 
 var codesite_token = null;
 
 
 var CS_env = {"profileUrl":null,"token":null,"assetHostPath":"http://www.gstatic.com/codesite/ph","domainName":null,"assetVersionPath":"http://www.gstatic.com/codesite/ph/4349413266511071651","projectHomeUrl":"/p/processing","relativeBaseUrl":"","projectName":"processing","loggedInUserEmail":null};
 var _gaq = _gaq || [];
 _gaq.push(
 ['siteTracker._setAccount', 'UA-18071-1'],
 ['siteTracker._trackPageview']);
 
 
 </script>
 
 
 <title>LibraryTemplate - 
 processing -
 
 Explanation of the Library Template for Eclipse - 
 An open source programming language and environment for creating images, animation, and interactions - Google Project Hosting
 </title>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" >
 
 <meta name="ROBOTS" content="NOARCHIVE">
 
 <link type="text/css" rel="stylesheet" href="http://www.gstatic.com/codesite/ph/4349413266511071651/css/core.css">
 
 <link type="text/css" rel="stylesheet" href="http://www.gstatic.com/codesite/ph/4349413266511071651/css/ph_detail.css" >
 
 
 
 <link type="application/atom+xml" rel="alternate" href="/feeds/p/processing/svnchanges/basic?path=/wiki/LibraryTemplate.wiki">
 
 
<!--[if IE]>
 <link type="text/css" rel="stylesheet" href="http://www.gstatic.com/codesite/ph/4349413266511071651/css/d_ie.css" >
<![endif]-->
 <style type="text/css">
 .menuIcon.off { background: no-repeat url(http://www.gstatic.com/codesite/ph/images/dropdown_sprite.gif) 0 -42px }
 .menuIcon.on { background: no-repeat url(http://www.gstatic.com/codesite/ph/images/dropdown_sprite.gif) 0 -28px }
 .menuIcon.down { background: no-repeat url(http://www.gstatic.com/codesite/ph/images/dropdown_sprite.gif) 0 0; }
 
 
 #maincol {
 padding-top: 0;
 padding-bottom: 0;
 }

 
 </style>
</head>
<body class="t6">
<script type="text/javascript">
 (function() {
 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
 (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
 })();
</script>
<div class="headbg">

 <div id="gaia">
 

 <span>
 
 <a href="#" id="projects-dropdown" onclick="return false;"><u>My favorites</u> <small>&#9660;</small></a>
 | <a href="https://www.google.com/accounts/ServiceLogin?service=code&amp;ltmpl=phosting&amp;continue=http%3A%2F%2Fcode.google.com%2Fp%2Fprocessing%2Fwiki%2FLibraryTemplate&amp;followup=http%3A%2F%2Fcode.google.com%2Fp%2Fprocessing%2Fwiki%2FLibraryTemplate" onclick="_CS_click('/gb/ph/signin');"><u>Sign in</u></a>
 
 </span>

 </div>

 <div class="gbh" style="left: 0pt;"></div>
 <div class="gbh" style="right: 0pt;"></div>
 
 
 <div style="height: 1px"></div>
<!--[if lte IE 7]>
<div style="text-align:center;">
Your version of Internet Explorer is not supported. Try a browser that
contributes to open source, such as <a href="http://www.firefox.com">Firefox</a>,
<a href="http://www.google.com/chrome">Google Chrome</a>, or
<a href="http://code.google.com/chrome/chromeframe/">Google Chrome Frame</a>.
</div>
<![endif]-->




 <table style="padding:0px; margin: 0px 0px 10px 0px; width:100%" cellpadding="0" cellspacing="0"
 itemscope itemtype="http://schema.org/CreativeWork">
 <tr style="height: 58px;">
 
 <td id="plogo">
 <link itemprop="url" href="/p/processing">
 <a href="/p/processing/">
 
 
 <img src="/p/processing/logo?cct=1316480720"
 alt="Logo" itemprop="image">
 
 </a>
 </td>
 
 <td style="padding-left: 0.5em">
 
 <div id="pname">
 <a href="/p/processing/"><span itemprop="name">processing</span></a>
 </div>
 
 <div id="psum">
 <a id="project_summary_link"
 href="/p/processing/"><span itemprop="description">An open source programming language and environment for creating images, animation, and interactions</span></a>
 
 </div>
 
 
 </td>
 <td style="white-space:nowrap;text-align:right; vertical-align:bottom;">
 
 <form action="/hosting/search">
 <input size="30" name="q" value="" type="text">
 
 <input type="submit" name="projectsearch" value="Search projects" >
 </form>
 
 </tr>
 </table>

</div>

 
<div id="mt" class="gtb"> 
 <a href="/p/processing/" class="tab ">Project&nbsp;Home</a>
 
 
 
 
 <a href="/p/processing/downloads/list" class="tab ">Downloads</a>
 
 
 
 
 
 <a href="/p/processing/w/list" class="tab active">Wiki</a>
 
 
 
 
 
 <a href="/p/processing/issues/list"
 class="tab ">Issues</a>
 
 
 
 
 
 <a href="/p/processing/source/checkout"
 class="tab ">Source</a>
 
 
 
 
 
 <div class=gtbc></div>
</div>
<table cellspacing="0" cellpadding="0" width="100%" align="center" border="0" class="st">
 <tr>
 
 
 
 <td class="subt">
 <div class="issueDetail">
<div class="isf">
 
 <span class="inIssueList"> 
 <span>Search</span>
 <form action="/p/processing/w/list" method="GET" style="display:inline">
 <select id="can" name="can" >
 <option disabled="disabled">Search within:</option>
 
 <option value="1" >&nbsp;All wiki pages</option>
 <option value="3" >&nbsp;Featured pages</option>
 <option value="2" selected="selected">&nbsp;Current pages</option>
 
 
 <option value="4" >&nbsp;Deprecated pages</option>
 
 </select>
 <span>for</span>
 <span id="qq"><input type="text" size="38" id="searchq" name="q" value=""
 autocomplete="off" ></span>
 
 
 
 <input type="submit" value="Search" >
 </form>
 </span>

 
 
 
 
 
 
 

</div>
</div>

 </td>
 
 
 
 
 
 
 <td align="right" valign="top" class="bevel-right"></td>
 </tr>
</table>


<script type="text/javascript">
 var cancelBubble = false;
 function _go(url) { document.location = url; }
</script>
<div id="maincol"
 
>

 
<!-- IE -->







 <style type="text/css">
 .delcom { background: #e8e8e8 }
 .commentcontent {
 margin: 2em;
 padding: 0px 10px;
 width: 66em;
 }
 .artifactcomment {
 border-top: 3px solid #c3d9ff;
 }
 #commentform {
 border-top: 3px solid #c3d9ff;
 }
 </style>

<div id="wikipage">
<table>
 <tr>
 
 
 <td style="vertical-align:top; padding-left:5px">
 
 <div id="wikiheader">
 
 <span style="font-size:120%;font-weight:bold">LibraryTemplate</span>
 &nbsp;
 <div> 
 
 <i>Explanation of the Library Template for Eclipse</i>
 
 
 
 <div id="wikiauthor" style="float:right">
 Updated <span title="Thu Nov  3 08:09:34 2011">
 Today (moments ago)</span>
 
 by <a style="white-space: nowrap" href="/u/104237777557728220129/">prisoner...@gmail.com</a>
 
 </div>
 </div>
 </div>
 
 <div id="wikicontent">
 <div class="vt" id="wikimaincol">
 <h2><a name="Eclipse_Library_Template"></a>Eclipse Library Template<a href="#Eclipse_Library_Template" class="section_anchor"></a></h2><p>The following describe how to set up a Processing library project in Eclipse and build it successfully, and to make your library ready for distribution. </p><ol><li>Download the latest Eclipse template from <a href="http://code.google.com/p/processing/downloads/list" rel="nofollow">here</a>. <strong>Don&#x27;t unzip the .zip file yet.</strong> </li><li>Create a new Java project in Eclipse.  </li><ul><li>From the menubar choose File → New → Java Project.  </li><li>Give the project the name of your library.  </li><li>Click &quot;Finish&quot;. </li></ul><li>Import the template source files. </li><ul><li>Right-click (ctrl-click) onto the folder icon of your newly created project in the &quot;Package Explorer&quot; and choose &quot;Import&quot; from the menu that pops up.  </li><li>Select General → Archive File, click &quot;Next&quot; and navigate to the zip file you downloaded earlier in step 1.  </li><li>Confirm the archive with &quot;Finish&quot;. </li></ul><li>Add Processing to the project build path. </li><ul><li>Open your project&#x27;s &quot;Properties&quot; window.  </li><li>Under &quot;Java Build Path&quot;, select the &quot;Libraries&quot; tab and then &quot;Add External JARs...&quot;.  </li><li>Locate and add Processing&#x27;s &quot;core.jar&quot; to your build path. It is recommended that a copy of &quot;core.jar&quot; is located in your Eclipse workspace in a &quot;libs&quot; folder. If the &quot;libs&quot; folder does not exist yet, create it. Read the section below regarding where to find the &quot;core.jar&quot; file. </li><li>Confirm the setup with &quot;OK&quot;. </li></ul><li>Edit the library properties. </li><ul><li>Open the &quot;resources&quot; folder inside of your Java project and double-click the &quot;build.properties&quot; file. You should see its content in the Eclipse editor.  </li><li>Edit the properties file, making changes to items 1-4 so that the values and paths are properly set for your project to compile. A path can be a relative path or absolute.  </li><li>Make changes to items under 5. These are metadata used in the automatically generated HTML, README, and properties documents. </li></ul><li>Compile your library using Ant. </li><ul><li>From the menu bar, choose Window → Show View → Ant. A tab with the title &quot;Ant&quot; will pop up on the right side of your Eclipse editor.  </li><li>Drag the &quot;resources/build.xml&quot; file in there, and a new item &quot;ProcessingLibs&quot; will appear.  </li><li>Press the &quot;Play&quot; button inside the &quot;Ant&quot; tab. </li></ul><li>BUILD SUCCESSFUL. The library template will start to compile, control-messages will appear in the console window, warnings can be ignored. When finished it should say BUILD SUCCESSFUL. Congratulations, you are set and you can start writing your own library by making changes to the source code in folder &quot;src&quot;. </li><li>BUILD FAILED. In case the compile process fails, check the output in the console which will give you a closer idea of what went wrong. Errors may have been caused by </li><ul><li>Incorrect path settings in the &quot;build.xml&quot; file. </li><li>Error &quot;Javadoc failed&quot;. if you are on Windows, make sure you are using a JDK instead of a JRE in order to be able to create the javadoc for your library. JRE does not come with the javadoc application, but it is required to create libraries from this template. </li></ul></ol><p>After having compiled and built your project successfully, you should be able to find your library in Processing&#x27;s sketchbook folder, examples will be listed in Processing&#x27;s sketchbook menu. Files that have been created for the distribution of the library are located in your Eclipse&#x27;s &quot;workspace/yourProject/distribution&quot; folder. In there you will also find the &quot;web&quot; folder which contains the documentation, a zip file for downloading your library, a folder with examples as well as the &quot;index.html&quot; and CSS file. </p><p>To distribute your library please refer to the <a href="/p/processing/wiki/LibraryGuidelines">LibraryGuidelines</a>. </p><h4><a name="Source_code"></a>Source code<a href="#Source_code" class="section_anchor"></a></h4><p>If you want to share your library&#x27;s source code, we recommend to use an online repository available for free at <a href="http://code.google.com" rel="nofollow">Google Code</a> or <a href="https://github.com/" rel="nofollow">GitHub</a>. </p><h4><a name="Adding_core.jar_and_other_.jar_files_to_your_classpath"></a>Adding core.jar and other .jar files to your classpath<a href="#Adding_core.jar_and_other_.jar_files_to_your_classpath" class="section_anchor"></a></h4><p>The core.jar file contains the core classes of Processing and has to be part of your classpath when building a library. On Windows and Linux, this file is located in the Processing distribution folder inside a folder named &quot;lib&quot;. On Mac OS X, right-click the Processing.app and use &quot;Show Package Contents&quot; to see the guts. The &quot;lib&quot; folder is at Contents → Resources → Java → lib. For further information about the classes in core.jar, you can see the source <a href="http://code.google.com/p/processing/source/browse/trunk/processing#processing/core" rel="nofollow">here</a> and the developer documentation <a href="http://processing.googlecode.com/svn/trunk/processing/build/javadoc/core/index.html" rel="nofollow">here</a>. </p><p>If you created a &quot;libs&quot; folder as described above, put the libraries you need to add to your classpath in there. In the &quot;Properties&quot; of your Java project, navigate to Java Build Path → Libraries, and click &quot;Add External JARs...&quot;. Select the .jar files from the &quot;libs&quot; folder that are required for compiling your project. Adjust the &quot;build.xml&quot; file accordingly. </p><p>The libs folder is recommended but not a requirement, nevertheless you need to specify where your jar files are located in your system in order to add them to the classpath. </p><p>In case a library depends on system libraries, put these dependencies next to the jar file. For example, Processing&#x27;s &quot;opengl.jar&quot; library depends on JOGL hence the DLLs (for Windows) or jnilibs (for OS X) have to be located next to the &quot;opengl.jar&quot; file. </p><h4><a name="What_is_the_difference_between_JDK_and_JRE?"></a>What is the difference between JDK and JRE?<a href="#What_is_the_difference_between_JDK_and_JRE?" class="section_anchor"></a></h4><p>JDK stands for Java Development Kit whereas JRE stands for Java Runtime Environment. For developers it is recommended to work with a JDK instead of a JRE since more Java development related applications such as Javadoc are included. Javadoc is a requirement to properly compile and document a Processing library as described on the guidelines page. </p><p>You can have both a JDK and a JRE installed on your system. In Eclipse you need to specify which one you want to use. </p><h4><a name="The_JRE_System_Library"></a>The JRE System Library<a href="#The_JRE_System_Library" class="section_anchor"></a></h4><p>This primarily affects Windows and Linux users (because the full JDK is installed by default on Mac OS X). It is recommended that you use the JDK instead of a JRE. The JDK can be downloaded from <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html" rel="nofollow">Oracle&#x27;s download site</a>. Also see the <a href="http://www.oracle.com/technetwork/java/javase/index-137561.html" rel="nofollow">Java Platform Installation page</a>, which contains useful information. </p><p>To change the JRE used to compile your Java project: </p><ol><li>Open the properties of your project from the menu Project → Properties. Select &quot;Java Build Path&quot; and in its submenu, click on the &quot;Libraries&quot; tab. </li><li>A list of JARs and class folders in the build path will show up. In this list you can find the JRE System Library that is used to compile your code. Remove this JRE System library. </li><li>Click &quot;Add Library...&quot;. In the popup window, choose &quot;JRE System Library&quot; and press &quot;Next&quot;. </li><li>Select an alternate JRE from the pull-down menu or click and modify the &quot;Installed JREs&quot;. Confirm with &quot;Finish&quot; and &quot;OK&quot;.  </li></ol><h4><a name="Compiling_with_Ant_and_javadoc"></a>Compiling with Ant and javadoc<a href="#Compiling_with_Ant_and_javadoc" class="section_anchor"></a></h4><p>Ant is a Java-based build tool. For <a href="http://ant.apache.org/faq.html#what-is-ant" rel="nofollow">more information</a> visit the <a href="http://ant.apache.org/" rel="nofollow">Ant web site</a>. Ant uses a file named &quot;build.xml&quot; to store build settings for a project. </p><p>Javadoc is an application that creates an HTML-based API documentation of Java code. You can check for its existence by typing javadoc on the command line. On Mac OS X, it is installed by default. On Windows and Linux, installing the JDK will also install the javadoc tool.  </p>
 </div>
 </div>
 </td><tr>
</table>
 </div>


 
 <div id="wikicommentcol">
 


 
 
 
 
 

<div class="collapse">


 


<div id="commentlist">

 
 <div class="artifactcomment"
 
 >
 
 
 
 
 
 
 <span class="author">Comment
 
 by 
 
 <a style="white-space: nowrap" href="/u/109288764876720210823/">joma...@gmail.com</a>,
 
 </span>
 <span class="date" title="Sat Apr 30 03:09:31 2011">Apr 30, 2011</span>
 <div>
<div class="commentcontent">
<p>Hi, in point 6, what are the changes that i need to do to the build.xml file? should I just replace the name of my project for the &quot;project&quot; tags in the document?... can&#x27;t get a successful build. Thx </p>
</div>
 
 
 </div>
 </div>
 

 
 <div class="artifactcomment"
 
 >
 
 
 
 
 
 
 <span class="author">Comment
 
 by  project member 
 
 <a style="white-space: nowrap" href="/u/113573968048082077986/">pkalaus...@gmail.com</a>,
 
 </span>
 <span class="date" title="Sat Apr 30 11:19:01 2011">Apr 30, 2011</span>
 <div>
<div class="commentcontent">
<p>The ant file loads properties from the build.properties file (located in the same directory as build.xml). You may need to edit this file and change your sketchbook.location and classpath.local.location properties to get your library to compile. </p><p>You shouldn&#x27;t need to edit your build.xml file. </p>
</div>
 
 
 </div>
 </div>
 

</div>
</div>

 


 <script type="text/javascript">
 function delComment(sequence_num, create_time, delete_mode) {
 var f = document.forms["delcom"];
 f.sequence_num.value = sequence_num;
 f.create_time.value = create_time;
 f.mode.value = delete_mode;
 f.submit();
 return false;
 }
 </script>


 </div>
 
 
 
 
 <br>
 <div class="artifactcomment">
 <span class="indicator">&#9658;</span> <a href="https://www.google.com/accounts/ServiceLogin?service=code&amp;ltmpl=phosting&amp;continue=http%3A%2F%2Fcode.google.com%2Fp%2Fprocessing%2Fwiki%2FLibraryTemplate&amp;followup=http%3A%2F%2Fcode.google.com%2Fp%2Fprocessing%2Fwiki%2FLibraryTemplate"
 >Sign in</a> to add a comment
 </div>
 
 
 
 
 <form name="delcom" action="../w/delComment.do" method="POST">
 <input type="hidden" name="sequence_num" value="" >
 <input type="hidden" name="create_time" value="" >
 <input type="hidden" name="mode" value="" >
 <input type="hidden" name="pagename" value="LibraryTemplate" >
 <input type="hidden" name="token" value="" >
 </form>



 <script src="http://www.gstatic.com/codesite/ph/4349413266511071651/js/prettify/prettify.js"></script>
 <script type="text/javascript">
 prettyPrint();
 </script>

<script type="text/javascript" src="http://www.gstatic.com/codesite/ph/4349413266511071651/js/dit_scripts.js"></script>


<script type="text/javascript" src="https://apis.google.com/js/plusone.js">
</script>

  
 
 
 <script type="text/javascript" src="http://www.gstatic.com/codesite/ph/4349413266511071651/js/ph_core.js"></script>
 
 
 
 
 <script type="text/javascript" src="/js/codesite_product_dictionary_ph.pack.04102009.js"></script>
</div> 
<div id="footer" dir="ltr">
 <div class="text">
 &copy;2011 Google -
 <a href="/projecthosting/terms.html">Terms</a> -
 <a href="http://www.google.com/privacy.html">Privacy</a> -
 <a href="/p/support/">Project Hosting Help</a>
 </div>
</div>
 <div class="hostedBy" style="margin-top: -20px;">
 <span style="vertical-align: top;">Powered by <a href="http://code.google.com/projecthosting/">Google Project Hosting</a></span>
 </div>
 
 


 
 </body>
</html>


